package com.blockchain.console.servlets.financial.ptzjgl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.financial.PtzjManage;
import com.blockchain.console.service.financial.entity.Ptzjgl;
import com.blockchain.console.service.trading.TradingManage;
import com.blockchain.console.service.trading.entity.XlbEntity;
import com.blockchain.console.servlets.financial.AbstractFinancialServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.framework.service.query.Paging;
import com.blockchain.framework.service.query.PagingResult;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_FINANCE_PTXLBGLLIST", isMenu = true, name = "平台虚拟币账户")
public class PtxlbglList extends AbstractFinancialServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		PtzjManage ptzjManage = serviceSession.getService(PtzjManage.class);
		int bid = IntegerParser.parse(request.getParameter("bid"));
		TradingManage tsradingManage = serviceSession.getService(TradingManage.class);
		XlbEntity[] xlb = tsradingManage.getXlbxx();
		PagingResult<Ptzjgl> result = ptzjManage.searchXlb(bid, new Paging() {

			@Override
			public int getSize() {
				return 10;
			}

			@Override
			public int getCurrentPage() {
				return IntegerParser.parse(request.getParameter(PAGING_CURRENT));
			}
		});

		request.setAttribute("result", result);
		request.setAttribute("xlb", xlb);
		forwardView(request, response, getClass());
	}
}
